From: Florian Müllner Date: Sun, 21 Feb 2010 05:25:23 +0000 (+0100) Subject: Remove source icon when a corresponding window is activated X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~10398 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=4d43424efdb168face0bb9afe8e0527f09637efb;p=gnome-shell.git Remove source icon when a corresponding window is activated Source icons are no longer needed to inform the user about events having occured in a particular application when (s)he activates the window - treat that case just as if the user had clicked the source icon. https://bugzilla.gnome.org/show_bug.cgi?id=610494 --- diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js index 2907f920d..fe7a08166 100644 --- a/js/ui/messageTray.js +++ b/js/ui/messageTray.js @@ -489,6 +489,12 @@ MessageTray.prototype = { } }, + removeSourceByApp: function(app) { + for (let source in this._sources) + if (this._sources[source].app == app) + this.removeSource(this._sources[source]); + }, + removeNotification: function(notification) { if (this._notification == notification && (this._notificationState == State.SHOWN || this._notificationState == State.SHOWING)) { if (this._notificationTimeoutId) { diff --git a/js/ui/notificationDaemon.js b/js/ui/notificationDaemon.js index 7f5dfcf7e..89710d62b 100644 --- a/js/ui/notificationDaemon.js +++ b/js/ui/notificationDaemon.js @@ -100,6 +100,9 @@ NotificationDaemon.prototype = { Lang.bind(this, this._lostName)); this._currentNotifications = {}; + + Shell.WindowTracker.get_default().connect('notify::focus-app', + Lang.bind(this, this._onFocusAppChanged)); }, _acquiredName: function() { @@ -260,6 +263,10 @@ NotificationDaemon.prototype = { ]; }, + _onFocusAppChanged: function(tracker) { + Main.messageTray.removeSourceByApp(tracker.focus_app); + }, + _actionInvoked: function(notification, action, source, id) { this._emitActionInvoked(id, action); source.destroy();